/**
 * @name TabBadge
 * @author darcrand
 * @desc
 */

import React, { Component } from "react"

function tabTypeToDesc(type = "ask") {
  const mapTypes = { ask: "问答", share: "分享", job: "招聘", good: "精华" }
  return mapTypes[type] || mapTypes.ask
}

/**
 * attr
 * @property {String} tab enum: "ask" | "share" | "job" | "good"
 */
class TabBadge extends Component {
  static defaultProps = {
    tab: "ask"
  }
  render() {
    return <span>[{tabTypeToDesc(this.props.tab)}]</span>
  }
}

export default TabBadge
